package chapter3.lc344;
//LC 344 反转字符串

/**
 * 双指针夹逼swap
 */
public class ReverseString {
    public void reverseString(char[] s) {
        for (int i = 0, j= s.length -1; i <j ;) {
            swap(s, i++, j--);
        }
    }

    private void swap(char[] s, int i, int j) {
        char temp = s[i];
        s[i] = s[j];
        s[j] = temp;
    }
}
